package com.cyzy.controller;

import com.cyzy.domin.TGoods;
import com.cyzy.dto.ResponseData;
import com.cyzy.service.TAreasService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/tareas")
public class TAreasController {

    @Autowired
    private TAreasService tareasService;

    // 查询地址
    @GetMapping("/getArea")
    public ResponseData getTAareas(){
        return tareasService.findTArea();
    }

    // 查看精选
    @GetMapping("/getGoods")
    public ResponseData getGoods(Integer areasId,String goodsName){
        System.out.println("1"+areasId+goodsName);
        System.out.println("2"+tareasService.findHeartProduct(areasId,goodsName));
        return tareasService.findHeartProduct(areasId,goodsName);
    }

    // 查询普通
    @GetMapping("/getConstGoods")
    public ResponseData getConstGoods(Integer areasId, String goodsName,Integer curr) {
        System.out.println(areasId + goodsName + curr);
        Integer size = 8;
        System.out.println(tareasService.findConstProduct(areasId, goodsName, curr, size));
        return tareasService.findConstProduct(areasId, goodsName, curr, size);
    }

    // 查询普通
    @GetMapping("/getConstGoods1")
    public ResponseData getConstGoods1(Integer areasId, String goodsName,Integer classifyId) {
        System.out.println(areasId + goodsName);
        System.out.println(tareasService.findConstProduct1(areasId, goodsName,classifyId));
        return tareasService.findConstProduct1(areasId, goodsName,classifyId);
    }

    // 查询商品的详细信息
    @GetMapping("/getAllGoods")
    public ResponseData findAllGoods(String goodsId) {
        System.out.println(goodsId);
        System.out.println("3"+tareasService.findAllGoods(goodsId));
        return tareasService.findAllGoods(goodsId);
    }

    // 查询订单的详细信息
    @GetMapping("/getAllEvalue")
    public ResponseData findEvalue(String goodsId) {
        System.out.println(goodsId+"kkkk");
        System.out.println(tareasService.findaEvalue(goodsId));
        return tareasService.findaEvalue(goodsId);
    }


}
